package com.cskaoyan.service.user;

import com.cskaoyan.mapper.WxUserMapper;
import com.cskaoyan.vo.user.WxUserLoginVo;
import com.cskaoyan.vo.wxorder.IndexOrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WxUserServiceImpl implements WxUserService {

    @Autowired
    WxUserMapper wxUserMapper;

    @Override
    public IndexOrderVo selectOrderInfo(Integer userId) {
        List<Integer> statusList = wxUserMapper.selectOrderInfo(userId);
        Integer unrecv = 0;
        Integer uncomment = 0;
        Integer unpaid = 0;
        Integer unship = 0;
        for (Integer status : statusList) {
            if (101 == status) {
                unpaid++;
            } else if (201 == status) {
                unship++;
            } else if (301 == status) {
                unrecv++;
            } else if (401 == status) {
                uncomment++;
            }
        }

        IndexOrderVo indexOrderVo = new IndexOrderVo();
        indexOrderVo.setUncomment(uncomment);
        indexOrderVo.setUnpaid(unpaid);
        indexOrderVo.setUnrecv(unrecv);
        indexOrderVo.setUnship(unship);
        return indexOrderVo;
    }

    // @Override
    // public WxUserLoginVo.UserInfoBean selectUserInfoByUsername(String username) {
    //     WxUserLoginVo.UserInfoBean userInfoBean = wxUserMapper.selectUserInfoByUsername(username);
    //
    //     return userInfoBean;
    // }

    // @Override
    // public String selectAvatarByUsername(String username) {
    //     String avatar= wxUserMapper.selectAvatarByUsername(username);
    //     return avatar;
    // }
}
